package com.woniuxy.ams.utils;

import com.woniuxy.ams.entity.User;
import com.woniuxy.ams.exception.UserNotLoginException;
import org.apache.shiro.SecurityUtils;

/**
 * @author fyx
 */
public class SystemUtils {
    private SystemUtils(){}

    public static User getLoginUser() {
        Object user = SecurityUtils.getSubject().getPrincipal();
        if (user instanceof User) {
            return (User) user;
        } else {
            throw new UserNotLoginException();
        }
    }
}
